#include <bits/stdc++.h>
// 2025/01/23
// tag: 
// Author: Zhang Muen
using namespace std;

int n, m, x, y;
int board[401][401], dir[8][2] = {{-1, -2}, {1, -2}, {-1, 2}, {1, 2}, {-2, -1}, {2, -1}, {-2, 1}, {2, 1}};

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> x >> y;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            board[i][j] = -1;
    queue<pair<int, int>> q;
    q.push({x, y});
    int cnt = 0;
    while (!q.empty()){
        int s = q.size();
        for (int i = 0; i < s; i++){
            auto p = q.front();
            q.pop();
            if (p.first < 1 || p.first > n || p.second < 1 || p.second > m)
                continue;
            if (board[p.first][p.second] != -1)
                continue;
            board[p.first][p.second] = cnt;
            for (int j = 0; j < 8; j++)
                q.push({p.first + dir[j][0], p.second + dir[j][1]});
        }
        cnt++;
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++)
            cout << board[i][j] << ' ';
        cout << endl;
    }
    return 0;
}